﻿@using InnovaApp.Layers.ResourcesLayer.Properties
@model InnovaApp.Portals.MVC4Portal.Models.ViewModels.LayoutViewModels.DynaContentViewModels.DynaContent_ViewModel
@{
    Layout = Model._CurrentSiteLayout;   
}
@section HeadLocalCSS {
    <style id="CSSExtension" data-hook="1">
        @Html.Raw(Model.ManagedContent.CSSExtension)
    </style>
}
@{
    bool translateMode = Request.QueryString["translate"] != null;  
}
@if (Model._AdminMode && !translateMode)
{ 
    @Html.HiddenFor(m => m.ControllerName, new { @id = "hidControllerName" })
    using (Ajax.BeginForm(actionName: "", routeValues: null, ajaxOptions: new AjaxOptions() { HttpMethod = "Post", OnSuccess = "$.fn.MainAjaxSuccess", OnFailure = "$.fn.MainAjaxFailure" }, htmlAttributes: new { @id = "frmManagedContent", @class = "ContentForm" }))
    {
    @Html.EditorFor(m => m.ManagedContent)
    <div id="divManagedContent">
        <div id="divStructurePage" class="notDisplayed">
            @Html.EditorFor(m => m.StructurePage)
        </div>
        <div class="notDisplayed">
            <input type="submit" id="cmdSaveContent" value="submit" />
        </div>
    </div>
    }
}
else if (!translateMode)
{
    using (Ajax.BeginForm(actionName: "", routeValues: null, ajaxOptions: new AjaxOptions()
    {
        HttpMethod
            = "Post",
        OnSuccess = "$.fn.MainAjaxSuccess",
        OnFailure = "$.fn.MainAjaxFailure"
    }, htmlAttributes: new { @class = "ContentForm" }))
    {
    <div id="divContent">
        @Html.Raw(Model.ManagedContent.ContentHTML)
    </div>
    }
}
else
{
    Layout = "~/Views/Shared/_LayoutTranslate.cshtml";
    @Html.Raw(Model.ManagedContent.ContentHTML)   
}
